package ds.dsr.server.enums;

/**
 * @author sunchong
 * @date 2018/4/23
 */
public enum  OpEnum {
    OP_GET_SERVICE_TABLE(1, "OP_GET_SERVICE_TABLE", "获取服务表"),
    OP_SERVICE_REGISTER(2, "OP_SERVICE_REGISTER", "服务注册"),
    OP_PONG(3, "OP_PONG", "pong");

    private Integer id;

    private String cmd;

    private String desc;

    OpEnum(Integer id, String cmd, String desc){
        this.id = id;
        this.cmd = cmd;
        this.desc =desc;
    }

    public Integer getId() {
         return this.id;
    }

    public static OpEnum getById(Integer id){
        if(id == null){
            return null;
        }
        for(OpEnum opEnum : OpEnum.values()){
            if(opEnum.id.equals(id)){
                return opEnum;
            }
        }
        return null;
    }


}
